function GetCookieVal(offset)
{var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)
endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}
function SetCookie(name,value)
{var expdate=new Date();var argv=SetCookie.arguments;var argc=SetCookie.arguments.length;var expires=(argc>2)?argv[2]:null;var path=(argc>3)?argv[3]:null;var domain=(argc>4)?argv[4]:null;var secure=(argc>5)?argv[5]:false;if(expires!=null)expdate.setTime(expdate.getTime()+(expires*1000));document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expdate.toGMTString()))
+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))
+((secure==true)?"; secure":"");}
function DelCookie(name)
{var exp=new Date();exp.setTime(exp.getTime()-1);var cval=GetCookie(name);document.cookie=name+"="+cval+"; expires="+exp.toGMTString();}
function GetCookie(name)
{var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen)
{var j=i+alen;if(document.cookie.substring(i,j)==arg)
return GetCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}
return null;}
function SearchObjectEndsWith(idName)
{for(i=0;i<document.all.length;i++)
{var id=document.all[i].id;if(id.length<idName.length)
continue;if(id.substr(id.length-idName.length,idName.length)==idName)
return document.all[i];}
return null;}
function OpenWindow(url,title,width,height)
{param="width="+width+",height="+height+", toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no,center=yes";window.open(url,title,param)}
function InitAd(x,y,layerName)
{document.getElementById(layerName).style.posTop=-200;document.getElementById(layerName).style.visibility='visible';MoveLayer(x,y,layerName);}
function HideAd(layerName)
{document.getElementById(layerName).style.visibility='hidden';}
function GetBodyScrollTop()
{if(document.documentElement.scrollTop!=0)
return document.documentElement.scrollTop;else
return document.body.scrollTop;}
function GetBodyWidth()
{if(document.documentElement.width!=0)
return document.documentElement.width;else
document.body.width;}
function MoveLayer(x,y,layerName)
{var scrollTop=GetBodyScrollTop();var diff=(scrollTop+y-document.all.AdLayer.style.posTop)*.40;var newy=scrollTop+y-diff;eval("document.all."+layerName+".style.posTop = newy");eval("document.all."+layerName+".style.posLeft = x");window.setTimeout("MoveLayer("+x+","+y+",'"+layerName+"');",20);}
function ReplaceSubstring(inputString,fromString,toString)
{var temp=inputString;if(fromString=="")
{return inputString;}
if(toString.indexOf(fromString)==-1)
{while(temp.indexOf(fromString)!=-1)
{var toTheLeft=temp.substring(0,temp.indexOf(fromString));var toTheRight=temp.substring(temp.indexOf(fromString)+fromString.length,temp.length);temp=toTheLeft+toString+toTheRight;}}
else
{var midStrings=new Array("~","`","_","^","#");var midStringLen=1;var midString="";while(midString=="")
{for(var i=0;i<midStrings.length;i++)
{var tempMidString="";for(var j=0;j<midStringLen;j++)
{tempMidString+=midStrings;}
if(fromString.indexOf(tempMidString)==-1)
{midString=tempMidString;i=midStrings.length+1;}}}
while(temp.indexOf(fromString)!=-1)
{var toTheLeft=temp.substring(0,temp.indexOf(fromString));var toTheRight=temp.substring(temp.indexOf(fromString)+fromString.length,temp.length);temp=toTheLeft+midString+toTheRight;}
while(temp.indexOf(midString)!=-1)
{var toTheLeft=temp.substring(0,temp.indexOf(midString));var toTheRight=temp.substring(temp.indexOf(midString)+midString.length,temp.length);temp=toTheLeft+toString+toTheRight;}}
return temp;}
function GetSystemName()
{var sReturn=navigator.userAgent.toLowerCase();var sWin='Windows ';try
{if(sReturn.indexOf('win')!=-1)
{if((sReturn.indexOf('nt')!=-1)&&(sReturn.indexOf('6.0')!=-1))return(sWin+'Vista');if((sReturn.indexOf('nt')!=-1)&&(sReturn.indexOf('5.2')!=-1))return(sWin+'2003');if((sReturn.indexOf('nt')!=-1)&&(sReturn.indexOf('5.1')!=-1))return(sWin+'XP');if((sReturn.indexOf('nt')!=-1)&&(sReturn.indexOf('5.0')!=-1))return(sWin+'2000');if(sReturn.indexOf('nt')!=-1)return(sWin+'NT 4.0');if((sReturn.indexOf('98')!=-1)&&(sReturn.indexOf('9x')!=-1))return(sWin+'Me');if(sReturn.indexOf('98')!=-1)return(sWin+'98');if(sReturn.indexOf('95')!=-1)return(sWin+'95');}
if(sReturn.indexOf('IRIX')!=-1)return('Irix');if(sReturn.indexOf('Mac')!=-1)return('Macintosh');}
catch(er)
{var sReturn='unknown';}
return sReturn;}
function GetBrowserName(){var bro=navigator.userAgent.toLowerCase();if(/msie/.test(bro))return'IE'+bro.match(/msie ([\d.]*);/)[1]
else if(/navigator/.test(bro))return'NS'+bro.match(/navigator\/([\d.]*)/)[1]
else if(/chrome/.test(bro))return'CR'+bro.match(/chrome\/([\d]*)/)[1]
else if(/safari/.test(bro))return'SF'+bro.match(/version\/([\d]*)/)[1]
else if(/opera/.test(bro))return'OP'+bro.match(/version\/([\d]*)/)[1]
else if(/firefox/.test(bro))return'FF'+bro.match(/firefox\/([\d]*)/)[1]
else return""}
function GetClientBaseData()
{data='&res='+escape(window.screen.width+'*'+window.screen.height)+'&color='+screen.colorDepth+'&language='+escape(navigator.systemLanguage)+'&os='+escape(GetSystemName())+'&browser='+escape(GetBrowserName());return data;}
function GetMSNPassport()
{try
{var msn=new ActiveXObject("Messenger.UIAutomation");MSNStatus=msn.MyStatus;var oService=msn.Services
var oPrimserv=oService.P
var oPrimserv=oService.PrimaryService
var MSNPassport=oPrimserv.MySigninName;return MSNPassport;}
catch(e)
{return"";}}
function CreateXmlHttp()
{var o=null;try
{o=new ActiveXObject("Msxml2.XMLHTTP");return o;}
catch(e)
{try
{o=new ActiveXObject("Microsoft.XMLHTTP");return o;}
catch(E)
{}}
if(o==null&&typeof(XMLHttpRequest)!="undefined")
{try
{o=new XMLHttpRequest();return o;}
catch(e)
{}}
return null;}
function AjaxRequest(serverPageUrl,parmString,requestMethod,callBack,bAsync)
{var ajax=CreateXmlHttp();if(ajax==null)
return null;if(requestMethod!="POST")
{requestMethod="GET";}
if(parmString!=null&&parmString.length)
{if(parmString.charAt(0)!='?')
{parmString='?'+parmString;}}
if(requestMethod=="GET")
{ajax.open("GET",serverPageUrl+parmString,(bAsync!=null)?bAsync:true);ajax.onreadystatechange=function()
{if(ajax.readyState==4&&ajax.status==200)
{if(callBack!=null)
{callBack(ajax.responseText);delete ajax;}}}
ajax.send(null);if((bAsync!=null)&&!bAsync)
{callBack(ajax.responseText);delete ajax;}}
if(requestMethod=="POST")
{ajax.open("POST",serverPageUrl+parmString,(bAsync!=null)?bAsync:true);ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");ajax.send(null);ajax.onreadystatechange=function()
{if(ajax.readyState==4&&ajax.status==200)
{if(callBack!=null)
{callBack(ajax.responseText);delete ajax;}}}
if((bAsync!=null)&&!bAsync)
{callBack(ajax.responseText);delete ajax;}}}
function CopyClipboardData(text)
{if(window.clipboardData)
{window.clipboardData.setData("Text",text);}else if(window.netscape)
{try
{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}catch(e)
{return false;}
var clip,trans,str={},clipid;if(!(clip=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard)))return;if(!(trans=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable)))return;trans.addDataFlavor("text/unicode");str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);str.data=text;trans.setTransferData("text/unicode",str,text.length*2);clipid=Components.interfaces.nsIClipboard;try
{clip.setData(trans,null,clipid.kGlobalClipboard);}catch(e)
{return false}}}
function coder(str)
{var s="";if(str.length==0)return"";for(var i=0;i<str.length;i++)
{switch(str.substr(i,1))
{case"<":s+="&lt;";break;case">":s+="&gt;";break;case" ":s+="&nbsp;";break;case"\'":s+="&#39;";break;case"\"":s+="&quot;";break;default:s+=str.substr(i,1);break;}}
return s;}
function get_element_id(obj)
{var element=null;if(document.getElementById)
{element=document.getElementById(obj);}
else if(document.all)
{element=document.all[obj];}
else if(document.layers)
{element=document.layers[obj];}
return element;}
function getQueryString(name){if(location.href.indexOf("?")==-1||location.href.indexOf(name+'=')==-1){return'';}
var queryString=location.href.substring(location.href.indexOf("?")+1);var parameters=queryString.split("&");var pos,paraName,paraValue;for(var i=0;i<parameters.length;i++){pos=parameters[i].indexOf('=');if(pos==-1){continue;}
paraName=parameters[i].substring(0,pos);paraValue=parameters[i].substring(pos+1);if(paraName==name){return unescape(paraValue.replace(/\+/g," "));}}
return'';}
function GetElementAbsPosByID(id)
{obj=get_element_id(id);posX=obj.offsetLeft;posY=obj.offsetTop;var aBox=obj;do
{aBox=aBox.offsetParent;posX+=aBox.offsetLeft;posY+=aBox.offsetTop;}while(aBox.tagName!="BODY");var o=new Array();o[0]=posX;o[1]=posY;return o;}
function ltrim(s){return s.replace(/^\s*/,"")}
function rtrim(s){return s.replace(/\s*$/,"");}
function trim(s){return rtrim(ltrim(s));}
function filterString(inputString){return coder(inputString).replace(/(\r\n)/g,"<br/>");}
function getNewSubmitForm(action){var __oHtml=document.documentElement;var __oBody;if(typeof(ducument)!='undefined'&&typeof(ducument.body)!='undefined')
__oBody=ducument.body;else if(__oHtml.childNodes.length>1&&__oHtml.childNodes.item(__oHtml.childNodes.length-1))
__oBody=__oHtml.childNodes.item(__oHtml.childNodes.length-1);else
__oBody=__oHtml.lastChild;var __oHead=__oHtml.firstChild;var submitForm=document.createElement("FORM");submitForm.method="POST";submitForm.action=action;__oBody.appendChild(submitForm);return submitForm;}
function createNewFormElement(inputForm,elementName,elementValue){var newElement=document.createElement("input");newElement.setAttribute("type","hidden");newElement.setAttribute("id",elementName);newElement.setAttribute("name",elementName);newElement.setAttribute("value",elementValue);inputForm.appendChild(newElement);return newElement;}
function setPic(img,wt,ht){try{wf=img.offsetWidth;hf=img.offsetHeight;if(wf>wt||hf>ht){if(Number(wf/hf)>Number(wt/ht)){img.width=wt;img.height=Number(wt*hf/wf);}else{img.height=ht;img.width=Number(ht*wf/hf);}}
else{img.width=wf;img.height=hf;}}catch(err){}}